package Luoguo;

import java.util.Scanner;

public class test3 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int h1 = sc.nextInt();
        int m1 = sc.nextInt();
        int h2 = sc.nextInt();
        int m2 = sc.nextInt();

        int r1=h2-h1;
        int r2=m2-m1;

        if(r2<0){
            r1--;
            r2+=60;
        }
        System.out.println(r1+" "+r2);

    }
}
